(ns liberator-sample.core.run-app
  (:require [liberator.dev :refer [wrap-trace]]
            [ring.middleware.params :refer [wrap-params]]
            [ring.middleware.reload :refer [wrap-reload]]
            [org.httpkit.server :as server]
            [liberator-sample.core.documentation.decisions :refer [wrap-request-accept app]]
            [compojure.handler :refer [site]]
            [clojure.java.io :as io]
            [clojure.string :as str]))


(let [dirs (keep #(when (.contains % "src") %)
                 (str/split (System/getProperty "java.class.path") #";"))
      h (-> #'app
            site
            wrap-request-accept
            (wrap-trace :ui)
            (wrap-reload {:dirs dirs}))]
  (server/run-server h {:port 3333}))
(println :started)